package com.yunhe.action;

import java.util.List;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.opensymphony.xwork2.ActionSupport;
import com.yunhe.biz.ISubjectBiz;
import com.yunhe.biz.impl.SubjectBizImpl;
import com.yunhe.entity.Subject;

public class DataAction extends ActionSupport{
	
	//创建json对象
		private JSONArray obj;
		
		

	public JSONArray getObj() {
			return obj;
		}



		public void setObj(JSONArray obj) {
			this.obj = obj;
		}


	//ISubjectBiz sb = new SubjectBizImpl();
	private ISubjectBiz sb;
	
	public ISubjectBiz getSb() {
		return sb;
	}



	public void setSb(ISubjectBiz sb) {
		this.sb = sb;
	}



	public String execute(){
		
		List<Subject> list = sb.searchSubjects();
		
		String[] subName = new String[list.size()];
		
		for(int i=0;i<list.size();i++){
			subName[i] = list.get(i).getVs_title();
		}
		
		this.setObj(JSONArray.fromObject(subName));
		return SUCCESS;
	}
}
